<?php

namespace Rainrock\Framework\Module;


use Rainrock\Framework\kernel\core\ModuleListener;

class SysmenuModuleListener extends ModuleListener{
	
	public function onListScript()
	{
		$barr['tablecans'] = array(
			'fanye' => false
		);
		$barr['abc'] = 'function(){alert(11)}';
		return $barr;
	}
	
	/**
	*	数据
	*/
	public function onDataListBefore()
	{
		return array(
			'order' => '`pid` asc,`sort` asc'
		);
	}
	
	private $newrows = array();
	public function onDataListAfter($rows)
	{
		$this->showrows($rows, 0, 0);
		return array(
			'rows' => $this->newrows
		);
	}
	
	private function showrows($rows, $pid, $xu){
		if($xu > 3)return;
		foreach($rows as $k=>$rs){
			if($rs['pid']==$pid){
				if($xu>0)$rs['name_style'] = 'padding-left:'.(30*$xu).'px';
				$this->newrows[] = $rs;
				$this->showrows($rows, $rs['id'], $xu+1);
			}
		}
	}
}